#pragma once

#include "ilogger.hpp"
#include "core/logger_config.hpp"
#include <memory>
#include <string>


class LoggerBuilder {
public:
    LoggerBuilder();

    // 返回*this 以支持链式调用
    LoggerBuilder& withLogLevel(LogLevel level);
    LoggerBuilder& withConsoleSink(bool apply_filtering = false);
    LoggerBuilder& withFileSink(const std::string& filename, size_t max_size, size_t max_files);
    LoggerBuilder& withNetworkSink(const std::string& url, long timeout = 5L, long connect_timeout = 2L);

    LoggerBuilder& withFilter(const std::string& pattern, const std::string& replacement);
    LoggerBuilder& clearFilters();

    LoggerBuilder& withJsonFormat();
    LoggerBuilder& withBasicFormat();

    LoggerBuilder& enableBacktrace(size_t size);


            
    // 最终的构建方法
    std::shared_ptr<ILogger> build();

private:
    LoggerConfig m_config;
};
